<template>
  <Echarts
    id="echarts"
    height="300px"
    :full-options="echartsOptions"
    :loading="loading"
  >
  </Echarts>
</template>
 
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
// 引进Echarts 组件
import Echarts from "@/components/Echarts/Echarts.vue";
// 引进Echarts 的options配置文件，可根据项目模块来创建该配置文件
// import chartOption from "../../components/Echarts/options";
const loading = ref(false); // 初始值可以根据实际情况设定
const echartsOptions = reactive({
  options: {},
  init: false,
});
// 此处可请求接口来获取数据
// 我的options配置使用的是dataset的形式，传进options中的两个参数data（图表的数据）和dimension（图表的维度），
onMounted(() => {
  const yDataArr = [10, 22, 28, 43, 49];
  const yDataArr2 = [25, 42, 30, 15, 10];
  // echartsOptions.options = chartOption.testOption(testData, testDimensions);
  echartsOptions.options = {
    title: {
      text: "区域填充图",
    },
    xAxis: {
      data: ["A", "B", "C", "D", "E"],
    },
    yAxis: {},

    series: [
      {
        type: "line",
        data: yDataArr,
        stack: "all", // 堆叠图的设置
        areaStyle: {},
      },
      {
        type: "line",
        data: yDataArr2,
        stack: "all", // 堆叠图的设置，与上边相同就行，名字无所谓
        areaStyle: {},
      },
    ],
  };
});
</script>